//window.plugins.webintent.write({ input: 'val1'});

var PluginWriter = function() {};
PluginWriter.prototype.write = function(params, success, fail) {
	return PhoneGap.exec(success, fail, 'PluginWriter', 'startActivity',
			[ params ]);
};
nfc.addNdefListener(
parseTag,
    function() {
        console.log("Success.");
        
        
    },
    function() {
        console.log("Fail.");
    }
);
nfc.addMimeTypeListener(
    "my/mimeType", 

    parseTag,     

    function() {
        console.log("Success.");
    }   ,
    function() {
        console.log("Fail.");
    }
);
/**
function parseTag(nfcEvent) {
    var records = nfcEvent.tag.ndefMessage;
	display = document.getElementById("tagContents");
    for (var i = 0; i < records.length; i++) {
        var record = records[i];
        alert(nfc.bytesToString(record.payload));
        p = document.createElement('p');
        p.innerHTML = nfc.bytesToString(record.payload);
        //display.appendChild(p);
    }	
}*/
PhoneGap.addConstructor(function() {
	PhoneGap.addPlugin('PluginWriter', new PluginWriter());
	/**
	PluginManager
			.addService('PluginWriter', 'com.a.plugin.writer.PluginWriter');
	*/
});